fix(notifications): Handle null provider in organization integrations filter#112368
Merged
fix(notifications): Handle null provider in organization integrations filter#112368
Conversation
… filter The organization integrations filter crashes when an entry has a null provider, causing the notification settings page to error. Add optional chaining to match the pattern already used for identity filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
leeandher
approved these changes
Apr 7, 2026
Member
leeandher
left a comment
There was a problem hiding this comment.
thank you for jumping on this!
TkDodo
reviewed
Apr 7, 2026
Collaborator
There was a problem hiding this comment.
please fix the types instead:
- useApiQuery<OrganizationIntegration[]>(
+ useApiQuery<Array<OrganizationIntegration | null>>(in that case, TypeScript will force us to add the optional chaining. Also, it’s doubtful that if we get an integration, it has no key, so we’d only need:
ALLOWED_PROVIDERS.has(orgIntegration?.provider.key as SupportedProviders)
Update the useApiQuery type parameter to Array<OrganizationIntegration | null> to reflect that entries can be null. Add a type guard on the filter so downstream code retains the narrowed OrganizationIntegration type. Remove unnecessary optional chaining on provider.key since a non-null integration should always have a provider. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 7, 2026
leeandher
added a commit
that referenced
this pull request
Apr 8, 2026
…ialization (#112391) some integrations failed to serialize, causing `null`s to appear in the list apis: <img width="1380" height="208" alt="image" src="https://github.com/user-attachments/assets/1c90c40d-edd1-43ff-bcae-930bc4be9d9d" /> this breaks frontend type assertions which necessitated the patch in #112368 to avoid the page crashing [the logs in sentry](https://sentry.sentry.io/issues/7384876727/?project=11276#logs) confirm that there were entries that failed to serialize here: <img width="473" height="90" alt="image" src="https://github.com/user-attachments/assets/3733161c-5df1-4907-830b-1bc262476bba" /> This fix will omit `None` entries from the response, so the frontend can be reset to being type safe, and add some more logging we can look into about why certain bad integrations can't be serialized. +tests --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@example.com>
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
… filter (#112368) Handle null provider in the organization integrations filter on the notification settings page. The `/users/me/organization-integrations/` API can return entries with a null `provider` field. The `ALLOWED_PROVIDERS` filter added in #111745 accesses `orgIntegration.provider.key` without null safety, crashing the page with `TypeError: Cannot read properties of null (reading 'provider')`. Adds optional chaining to match the pattern already used for the identity provider filter a few lines above. handles JAVASCRIPT-38j8 & JAVASCRIPT-38N4 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
…ialization (#112391) some integrations failed to serialize, causing `null`s to appear in the list apis: <img width="1380" height="208" alt="image" src="https://github.com/user-attachments/assets/1c90c40d-edd1-43ff-bcae-930bc4be9d9d" /> this breaks frontend type assertions which necessitated the patch in #112368 to avoid the page crashing [the logs in sentry](https://sentry.sentry.io/issues/7384876727/?project=11276#logs) confirm that there were entries that failed to serialize here: <img width="473" height="90" alt="image" src="https://github.com/user-attachments/assets/3733161c-5df1-4907-830b-1bc262476bba" /> This fix will omit `None` entries from the response, so the frontend can be reset to being type safe, and add some more logging we can look into about why certain bad integrations can't be serialized. +tests --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@example.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Handle null provider in the organization integrations filter on the
notification settings page.
The
/users/me/organization-integrations/API can return entries with anull
providerfield. TheALLOWED_PROVIDERSfilter added in #111745accesses
orgIntegration.provider.keywithout null safety, crashing thepage with
TypeError: Cannot read properties of null (reading 'provider').Adds optional chaining to match the pattern already used for the identity
provider filter a few lines above.
handles JAVASCRIPT-38j8 & JAVASCRIPT-38N4